home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Comm / term-source.lha / Extras / Source / term-Source.lha / ScreenPanel.c < prev    next >
C/C++ Source or Header  |  1995-06-17  |  46KB  |  1,711 lines

  1. /*
  2. **    ScreenPanel.c
  3. **
  4. **    Editing panel for screen configuration
  5. **
  6. **    Copyright © 1990-1995 by Olaf `Olsen' Barthel
  7. **        All Rights Reserved
  8. */
  9.  
  10. #include "termGlobal.h"
  11.  
  12. enum    {    GAD_SCREENMODE=1,GAD_USE_PUBSCREEN,GAD_PUBSCREENNAME,GAD_FONT,
  13.         GAD_COLOURMODE,GAD_SCREENTITLE,GAD_MAKESCREENPUBLIC,GAD_SHANGHAI,
  14.         GAD_BLINKING,GAD_PALETTE,GAD_RED,GAD_GREEN,GAD_BLUE,GAD_RESET,
  15.         GAD_STDPENS,GAD_EDITPENS,GAD_WINDOW_BORDER,GAD_SPLIT_STATUS,
  16.         GAD_STATUS_LINE,GAD_PAGER,GAD_PAGEGROUP,
  17.  
  18.         GAD_USE,GAD_CANCEL,GAD_DEFAULT };
  19.  
  20.     /* ModeFilter(register __a1 ULONG ID):
  21.      *
  22.      *    Screen display mode filter, rejects all
  23.      *    modes unapproriate for screen display.
  24.      */
  25.  
  26. STATIC ULONG __saveds __asm
  27. ModeFilter(register __a1 ULONG ID)
  28. {
  29.     struct DimensionInfo DimensionInfo;
  30.  
  31.     if(GetDisplayInfoData(NULL,(APTR)&DimensionInfo,sizeof(struct DimensionInfo),DTAG_DIMS,ID))
  32.     {
  33.         if(DimensionInfo . TxtOScan . MaxX - DimensionInfo . TxtOScan . MinX + 1 >= 640)
  34.             return(TRUE);
  35.     }
  36.  
  37.     return(FALSE);
  38. }
  39.  
  40. STATIC BYTE __regargs
  41. IsWrongMode(struct Configuration *LocalConfig,WORD OriginalMode)
  42. {
  43.     if(LocalConfig -> ScreenConfig -> ColourMode != OriginalMode || LocalConfig -> ScreenConfig -> UseWorkbench || Config -> ScreenConfig -> UseWorkbench || !Screen)
  44.         return(TRUE);
  45.     else
  46.     {
  47.         LONG Depth;
  48.  
  49.         Depth = GetBitMapDepth(Window -> WScreen -> RastPort . BitMap);
  50.  
  51.         switch(LocalConfig -> ScreenConfig -> ColourMode)
  52.         {
  53.             case COLOUR_AMIGA:
  54.  
  55.                 if(Depth < 2)
  56.                     return(TRUE);
  57.  
  58.                 break;
  59.  
  60.             case COLOUR_EIGHT:
  61.  
  62.                 if(Depth < 3)
  63.                     return(TRUE);
  64.  
  65.                 break;
  66.  
  67.             case COLOUR_SIXTEEN:
  68.  
  69.                 if(Depth < 4)
  70.                     return(TRUE);
  71.  
  72.                 break;
  73.         }
  74.  
  75.         return(FALSE);
  76.     }
  77. }
  78.  
  79. STATIC BYTE  __regargs
  80. SelectDisplayMode(struct Window *Window,ULONG *CurrentMode,struct Configuration *Config)
  81. {
  82.     BYTE Success = FALSE;
  83.  
  84.     if(AslBase -> lib_Version < 38)
  85.     {
  86.         struct List    *ModeList;
  87.         LONG         Index;
  88.  
  89.         if(ModeList = BuildModeList(&Index,*CurrentMode,ModeFilter))
  90.         {
  91.             struct LayoutHandle *Handle;
  92.  
  93.             if(Handle = LT_CreateHandleTags(Window -> WScreen,
  94.                 LH_LocaleHook,    &LocaleHook,
  95.             TAG_DONE))
  96.             {
  97.                 struct Window *LocalWindow;
  98.  
  99.                 LT_New(Handle,
  100.                     LA_Type,    VERTICAL_KIND,
  101.                 TAG_DONE);
  102.                 {
  103.                     LT_New(Handle,
  104.                         LA_Type,    VERTICAL_KIND,
  105.                     TAG_DONE);
  106.                     {
  107.                         LT_New(Handle,
  108.                             LA_Type,    LISTVIEW_KIND,
  109.                             LA_LabelID,    MSG_V36_0160,
  110.                             GTLV_Labels,    ModeList,
  111.                             LA_LONG,    &Index,
  112.                             LALV_CursorKey,    TRUE,
  113.                             LALV_Link,    NIL_LINK,
  114.                             LALV_MaxGrowY,    20,
  115.                             LALV_ResizeY,    TRUE,
  116.                             LA_Lines,    10,
  117.                             LA_Chars,    40,
  118.                             LA_CursorKey,    TRUE,
  119.                         TAG_DONE);
  120.  
  121.                         LT_EndGroup(Handle);
  122.                     }
  123.  
  124.                     LT_New(Handle,
  125.                         LA_Type,VERTICAL_KIND,
  126.                     TAG_DONE);
  127.                     {
  128.                         LT_New(Handle,
  129.                             LA_Type,    XBAR_KIND,
  130.                             LAXB_FullSize,    TRUE,
  131.                         TAG_DONE);
  132.  
  133.                         LT_EndGroup(Handle);
  134.                     }
  135.  
  136.                     LT_New(Handle,LA_Type,HORIZONTAL_KIND,
  137.                         LAGR_SameSize,    TRUE,
  138.                         LAGR_Spread,    TRUE,
  139.                     TAG_DONE);
  140.                     {
  141.                         LT_New(Handle,
  142.                             LA_Type,    BUTTON_KIND,
  143.                             LA_LabelID,    MSG_GLOBAL_USE_GAD,
  144.                             LA_ID,        GAD_USE,
  145.                             LABT_ReturnKey,    TRUE,
  146.                             LABT_ExtraFat,    TRUE,
  147.                         TAG_DONE);
  148.  
  149.                         LT_New(Handle,
  150.                             LA_Type,    BUTTON_KIND,
  151.                             LA_LabelID,    MSG_GLOBAL_CANCEL_GAD,
  152.                             LA_ID,        GAD_CANCEL,
  153.                             LABT_EscKey,    TRUE,
  154.                             LABT_ExtraFat,    TRUE,
  155.                         TAG_DONE);
  156.  
  157.                         LT_EndGroup(Handle);
  158.                     }
  159.  
  160.                     LT_EndGroup(Handle);
  161.                 }
  162.  
  163.                 if(LocalWindow = LT_Layout(Handle,LocaleString(MSG_V36_0161),NULL,0,0,IDCMP_CLOSEWINDOW,NULL,
  164.                     LAWN_HelpHook,        &GuideHook,
  165.                     LAWN_Parent,        Window,
  166.                     WA_DepthGadget,        TRUE,
  167.                     WA_CloseGadget,        TRUE,
  168.                     WA_DragBar,        TRUE,
  169.                     WA_RMBTrap,        TRUE,
  170.                     WA_Activate,        TRUE,
  171.                 TAG_DONE))
  172.                 {
  173.                     struct IntuiMessage    *Message;
  174.                     BOOL             Done = FALSE;
  175.                     ULONG             MsgClass,
  176.                                  MsgQualifier;
  177.                     UWORD             MsgCode;
  178.                     struct Gadget        *MsgGadget;
  179.                     LONG             i;
  180.                     struct ModeNode        *ModeNode;
  181.  
  182.                     do
  183.                     {
  184.                         WaitPort(LocalWindow -> UserPort);
  185.  
  186.                         while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
  187.                         {
  188.                             MsgClass    = Message -> Class;
  189.                             MsgCode        = Message -> Code;
  190.                             MsgQualifier    = Message -> Qualifier;
  191.                             MsgGadget    = (struct Gadget *)Message -> IAddress;
  192.  
  193.                             LT_ReplyIMsg(Message);
  194.  
  195.                             if(MsgClass == IDCMP_CLOSEWINDOW)
  196.                                 Done = TRUE;
  197.  
  198.                             if(MsgClass == IDCMP_GADGETUP)
  199.                             {
  200.                                 switch(MsgGadget -> GadgetID)
  201.                                 {
  202.                                     case GAD_USE:
  203.  
  204.                                         for(ModeNode = (struct ModeNode *)ModeList -> lh_Head, i = 0; ModeNode -> VanillaNode . ln_Succ ; ModeNode = (struct ModeNode *)ModeNode -> VanillaNode . ln_Succ, i++)
  205.                                         {
  206.                                             if(Index == i)
  207.                                             {
  208.                                                 *CurrentMode = ModeNode -> DisplayID;
  209.  
  210.                                                 break;
  211.                                             }
  212.                                         }
  213.  
  214.                                         Success = Done = TRUE;
  215.                                         break;
  216.  
  217.                                     case GAD_CANCEL:
  218.  
  219.                                         Done = TRUE;
  220.                                         break;
  221.                                 }
  222.                             }
  223.  
  224.                             if(MsgClass == IDCMP_IDCMPUPDATE)
  225.                             {
  226.                                 for(ModeNode = (struct ModeNode *)ModeList -> lh_Head, i = 0; ModeNode -> VanillaNode . ln_Succ ; ModeNode = (struct ModeNode *)ModeNode -> VanillaNode . ln_Succ, i++)
  227.                                 {
  228.                                     if(Index == i)
  229.                                     {
  230.                                         *CurrentMode = ModeNode -> DisplayID;
  231.  
  232.                                         Success = Done = TRUE;
  233.  
  234.                                         LT_PressButton(Handle,GAD_USE);
  235.  
  236.                                         break;
  237.                                     }
  238.                                 }
  239.                             }
  240.                         }
  241.                     }
  242.                     while(!Done);
  243.  
  244.                     if(Success)
  245.                     {
  246.                         Config -> ScreenConfig -> Depth        = 0;
  247.                         Config -> ScreenConfig -> OverscanType    = OSCAN_TEXT;
  248.                         Config -> ScreenConfig -> DisplayWidth    = 0;
  249.                         Config -> ScreenConfig -> DisplayHeight    = 0;
  250.                     }
  251.                 }
  252.  
  253.                 LT_DeleteHandle(Handle);
  254.             }
  255.  
  256.             DeleteList(ModeList);
  257.         }
  258.     }
  259.     else
  260.     {
  261.         struct TagItem             DimensionTags[5];
  262.         struct ScreenModeRequester    *Request;
  263.         struct Hook             FilterHook;
  264.         LONG                 DisplayWidth,
  265.                          DisplayHeight,
  266.                          Depth,
  267.                          MinDepth;
  268.         struct Rectangle         DisplayClip;
  269.  
  270.         Depth = Config -> ScreenConfig -> Depth;
  271.  
  272.         FilterHook . h_Entry    = (HOOKFUNC)ModeFilter;
  273.         FilterHook . h_SubEntry    = NULL;
  274.         FilterHook . h_Data    = NULL;
  275.  
  276.         switch(Config -> ScreenConfig -> ColourMode)
  277.         {
  278.             case COLOUR_AMIGA:
  279.  
  280.                 MinDepth = 2;
  281.                 break;
  282.  
  283.             case COLOUR_EIGHT:
  284.  
  285.                 MinDepth = 3;
  286.                 break;
  287.  
  288.             case COLOUR_SIXTEEN:
  289.  
  290.                 MinDepth = 4;
  291.                 break;
  292.  
  293.             case COLOUR_MONO:
  294.  
  295.                 MinDepth = 1;
  296.                 break;
  297.         }
  298.  
  299.         if(Depth < MinDepth)
  300.             Depth = MinDepth;
  301.  
  302.         if((!Config -> ScreenConfig -> DisplayWidth || !Config -> ScreenConfig -> DisplayHeight) && QueryOverscan(Config -> ScreenConfig -> DisplayMode,&DisplayClip,Config -> ScreenConfig -> OverscanType))
  303.         {
  304.             DisplayWidth    = DisplayClip . MaxX - DisplayClip . MinX + 1;
  305.             DisplayHeight    = DisplayClip . MaxY - DisplayClip . MinY + 1;
  306.         }
  307.         else
  308.         {
  309.             DisplayWidth    = Config -> ScreenConfig -> DisplayWidth;
  310.             DisplayHeight    = Config -> ScreenConfig -> DisplayHeight;
  311.         }
  312.  
  313.         if(Request = (struct ScreenModeRequester *)AllocAslRequestTags(ASL_ScreenModeRequest,
  314.             ASLSM_Window,            Window,
  315.             ASLSM_InitialDisplayID,        *CurrentMode,
  316.             ASLSM_FilterFunc,        &FilterHook,
  317.             ASLSM_PrivateIDCMP,        TRUE,
  318.             ASLSM_InitialDisplayDepth,    Depth,
  319.             ASLSM_MinDepth,            MinDepth,
  320.             ASLSM_MaxDepth,            8,
  321.             ASLSM_DoDepth,            TRUE,
  322.             ASLSM_MinWidth,            640,
  323.             ASLSM_MinHeight,        200,
  324.             ASLSM_DoWidth,            TRUE,
  325.             ASLSM_DoHeight,            TRUE,
  326.             ASLSM_DoOverscanType,        TRUE,
  327.             ASLSM_InitialOverscanType,    Config -> ScreenConfig -> OverscanType,
  328.  
  329.             DisplayWidth  ? ASLSM_InitialDisplayWidth  : TAG_IGNORE, DisplayWidth,
  330.             DisplayHeight ? ASLSM_InitialDisplayHeight : TAG_IGNORE, DisplayHeight,
  331.         TAG_DONE))
  332.         {
  333.             if(AslRequest(Request,GetDimensionTags(NULL,DimensionTags)))
  334.             {
  335.                 PutDimensionTags(Window,Request -> sm_LeftEdge,Request -> sm_TopEdge,Request -> sm_Width,Request -> sm_Height);
  336.  
  337.                 *CurrentMode = Request -> sm_DisplayID;
  338.  
  339.                 if(Request -> sm_DisplayDepth == MinDepth)
  340.                     Depth = 0;
  341.                 else
  342.                     Depth = Request -> sm_DisplayDepth;
  343.  
  344.                 Config -> ScreenConfig -> Depth        = Depth;
  345.                 Config -> ScreenConfig -> OverscanType    = Request -> sm_OverscanType;
  346.                 Config -> ScreenConfig -> DisplayWidth    = Request -> sm_DisplayWidth;
  347.                 Config -> ScreenConfig -> DisplayHeight    = Request -> sm_DisplayHeight;
  348.  
  349.                 Success = TRUE;
  350.             }
  351.  
  352.             FreeAslRequest(Request);
  353.         }
  354.     }
  355.  
  356.     return(Success);
  357. }
  358.  
  359. STATIC BOOLEAN __regargs
  360. PenPanel(struct Window *Window,UWORD *Array,UWORD *DefaultArray,WORD Depth)
  361. {
  362.     struct LayoutHandle    *Handle;
  363.     UWORD             PrivateArray[16];
  364.     BOOLEAN             Result = FALSE;
  365.  
  366.     CopyMem(Array,PrivateArray,sizeof(PrivateArray));
  367.  
  368.     if(Handle = LT_CreateHandleTags(Window -> WScreen,
  369.         LH_LocaleHook,    &LocaleHook,
  370.         LH_ExactClone,    TRUE,
  371.     TAG_DONE))
  372.     {
  373.         struct Window *PanelWindow;
  374.  
  375.         LT_New(Handle,
  376.             LA_Type,    VERTICAL_KIND,
  377.         TAG_DONE);
  378.         {
  379.             LT_New(Handle,
  380.                 LA_Type,    VERTICAL_KIND,
  381.                 LA_LabelID,    MSG_PENPANEL_DRAWING_PENS_TXT,
  382.             TAG_DONE);
  383.             {
  384.                 LT_New(Handle,
  385.                     LA_Type,    VERTICAL_KIND,
  386.                 TAG_DONE);
  387.                 {
  388.                     LT_New(Handle,
  389.                         LA_Type,        PALETTE_KIND,
  390.                         LA_LabelID,        MSG_PENPANEL_BACKGROUND_TXT,
  391.                         GTPA_Depth,        Depth,
  392.                         LAPA_SmallPalette,    TRUE,
  393.                         LA_UWORD,        &PrivateArray[BACKGROUNDPEN],
  394.                         LA_Chars,        15,
  395.                         LA_ID,            100 + BACKGROUNDPEN,
  396.                     TAG_DONE);
  397.  
  398.                     LT_New(Handle,
  399.                         LA_Type,        PALETTE_KIND,
  400.                         LA_LabelID,        MSG_PENPANEL_TEXT_TXT,
  401.                         GTPA_Depth,        Depth,
  402.                         LAPA_SmallPalette,    TRUE,
  403.                         LA_UWORD,        &PrivateArray[TEXTPEN],
  404.                         LA_ID,            100 + TEXTPEN,
  405.                     TAG_DONE);
  406.  
  407.                     LT_New(Handle,
  408.                         LA_Type,        PALETTE_KIND,
  409.                         LA_LabelID,        MSG_PENPANEL_IMPORTANT_TEXT_TXT,
  410.                         GTPA_Depth,        Depth,
  411.                         LAPA_SmallPalette,    TRUE,
  412.                         LA_UWORD,        &PrivateArray[HIGHLIGHTTEXTPEN],
  413.                         LA_ID,            100 + HIGHLIGHTTEXTPEN,
  414.                     TAG_DONE);
  415.  
  416.                     LT_New(Handle,
  417.                         LA_Type,        PALETTE_KIND,
  418.                         LA_LabelID,        MSG_PENPANEL_BRIGHT_EDGES_TXT,
  419.                         GTPA_Depth,        Depth,
  420.                         LAPA_SmallPalette,    TRUE,
  421.                         LA_UWORD,        &PrivateArray[SHINEPEN],
  422.                         LA_ID,            100 + SHINEPEN,
  423.                     TAG_DONE);
  424.  
  425.                     LT_New(Handle,
  426.                         LA_Type,        PALETTE_KIND,
  427.                         LA_LabelID,        MSG_PENPANEL_DARK_EDGES_TXT,
  428.                         GTPA_Depth,        Depth,
  429.                         LAPA_SmallPalette,    TRUE,
  430.                         LA_UWORD,        &PrivateArray[SHADOWPEN],
  431.                         LA_ID,            100 + SHADOWPEN,
  432.                     TAG_DONE);
  433.  
  434.                     LT_New(Handle,
  435.                         LA_Type,        PALETTE_KIND,
  436.                         LA_LabelID,        MSG_PENPANEL_FILLPEN_TXT,
  437.                         GTPA_Depth,        Depth,
  438.                         LAPA_SmallPalette,    TRUE,
  439.                         LA_UWORD,        &PrivateArray[FILLPEN],
  440.                         LA_ID,            100 + FILLPEN,
  441.                     TAG_DONE);
  442.  
  443.                     LT_New(Handle,
  444.                         LA_Type,        PALETTE_KIND,
  445.                         LA_LabelID,        MSG_PENPANEL_FILLTEXTPEN_TXT,
  446.                         GTPA_Depth,        Depth,
  447.                         LAPA_SmallPalette,    TRUE,
  448.                         LA_UWORD,        &PrivateArray[FILLTEXTPEN],
  449.                         LA_ID,            100 + FILLTEXTPEN,
  450.                     TAG_DONE);
  451.  
  452.                     LT_New(Handle,
  453.                         LA_Type,        PALETTE_KIND,
  454.                         LA_LabelID,        MSG_PENPANEL_BARFILLPEN_TXT,
  455.                         GTPA_Depth,        Depth,
  456.                         LAPA_SmallPalette,    TRUE,
  457.                         LA_UWORD,        &PrivateArray[BARBLOCKPEN],
  458.                         LA_ID,            100 + BARBLOCKPEN,
  459.                     TAG_DONE);
  460.  
  461.                     LT_New(Handle,
  462.                         LA_Type,        PALETTE_KIND,
  463.                         LA_LabelID,        MSG_PENPANEL_BARTEXTPEN_TXT,
  464.                         GTPA_Depth,        Depth,
  465.                         LAPA_SmallPalette,    TRUE,
  466.                         LA_UWORD,        &PrivateArray[BARDETAILPEN],
  467.                         LA_ID,            100 + BARDETAILPEN,
  468.                     TAG_DONE);
  469.  
  470.                     LT_EndGroup(Handle);
  471.                 }
  472.  
  473.                 LT_New(Handle,
  474.                     LA_Type,XBAR_KIND,
  475.                 TAG_DONE);
  476.  
  477.                 LT_New(Handle,
  478.                     LA_Type,    VERTICAL_KIND,
  479.                 TAG_DONE);
  480.                 {
  481.                     LT_New(Handle,
  482.                         LA_Type,    BUTTON_KIND,
  483.                         LA_LabelID,    MSG_PENPANEL_STANDARDPENS_TXT,
  484.                         LA_ID,        GAD_DEFAULT,
  485.                         LABT_ExtraFat,    TRUE,
  486.                     TAG_DONE);
  487.  
  488.                     LT_EndGroup(Handle);
  489.                 }
  490.  
  491.                 LT_EndGroup(Handle);
  492.             }
  493.  
  494.             LT_New(Handle,
  495.                 LA_Type,VERTICAL_KIND,
  496.             TAG_DONE);
  497.             {
  498.                 LT_New(Handle,
  499.                     LA_Type,    XBAR_KIND,
  500.                     LAXB_FullSize,    TRUE,
  501.                 TAG_DONE);
  502.  
  503.                 LT_EndGroup(Handle);
  504.             }
  505.  
  506.             LT_New(Handle,LA_Type,HORIZONTAL_KIND,
  507.                 LAGR_SameSize,    TRUE,
  508.                 LAGR_Spread,    TRUE,
  509.             TAG_DONE);
  510.             {
  511.                 LT_New(Handle,
  512.                     LA_Type,    BUTTON_KIND,
  513.                     LA_LabelID,    MSG_GLOBAL_USE_GAD,
  514.                     LA_ID,        GAD_USE,
  515.                     LABT_ReturnKey,    TRUE,
  516.                     LABT_ExtraFat,    TRUE,
  517.                 TAG_DONE);
  518.  
  519.                 LT_New(Handle,
  520.                     LA_Type,    BUTTON_KIND,
  521.                     LA_LabelID,    MSG_GLOBAL_CANCEL_GAD,
  522.                     LA_ID,        GAD_CANCEL,
  523.                     LABT_EscKey,    TRUE,
  524.                     LABT_ExtraFat,    TRUE,
  525.                 TAG_DONE);
  526.  
  527.                 LT_EndGroup(Handle);
  528.             }
  529.  
  530.             LT_EndGroup(Handle);
  531.         }
  532.  
  533.         if(PanelWindow = LT_Layout(Handle,LocaleString(MSG_PENPANEL_SCREEN_DRAWING_PENS_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
  534.             LAWN_HelpHook,        &GuideHook,
  535.             LAWN_Parent,        Window,
  536.             WA_DepthGadget,        TRUE,
  537.             WA_CloseGadget,        TRUE,
  538.             WA_DragBar,        TRUE,
  539.             WA_RMBTrap,        TRUE,
  540.             WA_Activate,        TRUE,
  541.         TAG_DONE))
  542.         {
  543.             struct IntuiMessage    *Message;
  544.             BOOLEAN             Done = FALSE;
  545.             ULONG             MsgClass,
  546.                          MsgQualifier;
  547.             UWORD             MsgCode;
  548.             struct Gadget        *MsgGadget;
  549.             WORD             i;
  550.  
  551.             PushWindow(PanelWindow);
  552.  
  553.             LT_ShowWindow(Handle,TRUE);
  554.  
  555.             GuideContext(CONTEXT_SCREEN);
  556.  
  557.             do
  558.             {
  559.                 if(Wait(PORTMASK(PanelWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
  560.                     break;
  561.  
  562.                 while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
  563.                 {
  564.                     MsgClass    = Message -> Class;
  565.                     MsgQualifier    = Message -> Qualifier;
  566.                     MsgCode        = Message -> Code;
  567.                     MsgGadget    = (struct Gadget *)Message -> IAddress;
  568.  
  569.                     LT_ReplyIMsg(Message);
  570.  
  571.                     if(MsgClass == IDCMP_CLOSEWINDOW)
  572.                         Done = TRUE;
  573.  
  574.                     if(MsgClass == IDCMP_GADGETUP)
  575.                     {
  576.                         switch(MsgGadget -> GadgetID)
  577.                         {
  578.                             case GAD_USE:
  579.  
  580.                                 CopyMem(PrivateArray,Array,sizeof(PrivateArray));
  581.  
  582.                                 Array[DETAILPEN]    = PrivateArray[BACKGROUNDPEN];
  583.                                 Array[BLOCKPEN]        = PrivateArray[SHADOWPEN];
  584.                                 Array[BARTRIMPEN]    = PrivateArray[BARDETAILPEN];
  585.  
  586.                                 Result = Done = TRUE;
  587.                                 break;
  588.  
  589.                             case GAD_CANCEL:
  590.  
  591.                                 Done = TRUE;
  592.                                 break;
  593.  
  594.                             case GAD_DEFAULT:
  595.  
  596.                                 for(i = TEXTPEN ; i <= BARBLOCKPEN ; i++)
  597.                                     LT_SetAttributes(Handle,100 + i,GTPA_Color,DefaultArray[i],TAG_DONE);
  598.  
  599.                                 break;
  600.                         }
  601.                     }
  602.                 }
  603.             }
  604.             while(!Done);
  605.  
  606.             PopWindow();
  607.         }
  608.  
  609.         LT_DeleteHandle(Handle);
  610.     }
  611.  
  612.     return(Result);
  613. }
  614.  
  615. BYTE __regargs
  616. ScreenPanel(struct Configuration *LocalConfig,BYTE *Default)
  617. {
  618.     STATIC LONG PageTitleID[6] =
  619.     {
  620.         MSG_V36_0163,
  621.         MSG_V36_0164,
  622.         MSG_V36_0165,
  623.         MSG_V36_0166,
  624.         MSG_PENPANEL_DRAWING_PENS_TXT,
  625.         -1
  626.     };
  627.  
  628.     STATIC BYTE         InitialPage = 0;
  629.  
  630.     struct LayoutHandle    *Handle;
  631.     BYTE             Cancel = FALSE;
  632.     STRPTR             PageTitle[6];
  633.  
  634.     LocalizeStringTable(PageTitle,PageTitleID);
  635.  
  636.     SaveConfig(LocalConfig,PrivateConfig);
  637.  
  638.     if(!LocalConfig -> ScreenConfig -> UseColours96)
  639.     {
  640.         Colour12x96(LocalConfig -> ScreenConfig -> Colours,LocalConfig -> ScreenConfig -> Colours96,16);
  641.  
  642.         LocalConfig -> ScreenConfig -> UseColours96 = TRUE;
  643.     }
  644.  
  645.     if(Handle = LT_CreateHandleTags(Window -> WScreen,
  646.         LH_LocaleHook,    &LocaleHook,
  647.         LH_ExactClone,    TRUE,
  648.         LH_ExitFlush,    FALSE,
  649.     TAG_DONE))
  650.     {
  651.         struct Window    *LocalWindow;
  652.         UBYTE         ModeName[DISPLAYNAMELEN + 1],
  653.                  FontName[MAX_FILENAME_LENGTH];
  654.         ULONG         DisplayMode;
  655.         BOOL         WrongMode = IsWrongMode(LocalConfig,PrivateConfig -> ScreenConfig -> ColourMode);
  656.  
  657.         DisplayMode = LocalConfig -> ScreenConfig -> DisplayMode;
  658.  
  659.         if(ModeNotAvailable(DisplayMode))
  660.         {
  661.             struct Screen *PubScreen = LockPubScreen(NULL);
  662.  
  663.             if(PubScreen)
  664.             {
  665.                 struct DimensionInfo DimensionInfo;
  666.  
  667.                 DisplayMode = GetVPModeID(&PubScreen -> ViewPort);
  668.  
  669.                 if(GetDisplayInfoData(NULL,(APTR)&DimensionInfo,sizeof(struct DimensionInfo),DTAG_DIMS,DisplayMode))
  670.                 {
  671.                     LONG    Width    = DimensionInfo . TxtOScan . MaxX - DimensionInfo . TxtOScan . MinX + 1,
  672.                         Height    = DimensionInfo . TxtOScan . MaxY - DimensionInfo . TxtOScan . MinY + 1;
  673.  
  674.                     if(Width != LocalConfig -> ScreenConfig -> DisplayWidth && LocalConfig -> ScreenConfig -> DisplayWidth)
  675.                         LocalConfig -> ScreenConfig -> DisplayWidth = Width;
  676.  
  677.                     if(Height != LocalConfig -> ScreenConfig -> DisplayHeight && LocalConfig -> ScreenConfig -> DisplayHeight)
  678.                         LocalConfig -> ScreenConfig -> DisplayHeight = Height;
  679.                 }
  680.  
  681.                 UnlockPubScreen(NULL,PubScreen);
  682.             }
  683.             else
  684.                 DisplayMode = DEFAULT_MONITOR_ID | HIRES_KEY;
  685.         }
  686.  
  687.         strcpy(ModeName,GetModeName(DisplayMode));
  688.  
  689.         BuildFontName(FontName,LocalConfig -> ScreenConfig -> FontName,LocalConfig -> ScreenConfig -> FontHeight);
  690.  
  691.         if(!Screen || LocalConfig -> ScreenConfig -> ColourMode != Config -> ScreenConfig -> ColourMode)
  692.         {
  693.             if(Kick30)
  694.             {
  695.                 if(InitialPage > 2)
  696.                     InitialPage = 2;
  697.  
  698.                 PageTitle[3] = NULL;
  699.             }
  700.             else
  701.             {
  702.                 if(InitialPage > 3)
  703.                     InitialPage = 3;
  704.  
  705.                 PageTitle[4] = NULL;
  706.             }
  707.         }
  708.         else
  709.             PageTitle[5] = NULL;
  710.  
  711.         LT_New(Handle,
  712.             LA_Type,    VERTICAL_KIND,
  713.         TAG_DONE);
  714.         {
  715.             LT_New(Handle,
  716.                 LA_Type,VERTICAL_KIND,
  717.             TAG_DONE);
  718.             {
  719.                 LT_New(Handle,
  720.                     LA_Type,    CYCLE_KIND,
  721.                     LA_ID,        GAD_PAGER,
  722.                     LA_LabelID,    MSG_XFER_PAGE_TXT,
  723.                     GTCY_Labels,    PageTitle,
  724.                     LACY_AutoPageID,GAD_PAGEGROUP,
  725.                     LACY_TabKey,    TRUE,
  726.                     LA_BYTE,    &InitialPage,
  727.                 TAG_DONE);
  728.  
  729.                 LT_EndGroup(Handle);
  730.             }
  731.  
  732.             LT_New(Handle,
  733.                 LA_Type,    VERTICAL_KIND,
  734.                 LA_ID,        GAD_PAGEGROUP,
  735.                 LAGR_Frame,    TRUE,
  736.                 LAGR_ActivePage,InitialPage,
  737.             TAG_DONE);
  738.             {
  739.                 LT_New(Handle,
  740.                     LA_Type,    VERTICAL_KIND,
  741.                 TAG_DONE);
  742.                 {
  743.                     LT_New(Handle,
  744.                         LA_Type,    VERTICAL_KIND,
  745.                     TAG_DONE);
  746.                     {
  747.                         LT_New(Handle,
  748.                             LA_Type,    TEXT_KIND,
  749.                             LA_LabelID,    MSG_SCREENPANEL_CURRENT_DISPLAY_MODE_GAD,
  750.                             LA_Chars,    20,
  751.                             LA_ID,        GAD_SCREENMODE,
  752.                             GTTX_Text,    ModeName,
  753.                             GTTX_Border,    TRUE,
  754.                             LATX_Picker,    TRUE,
  755.                             LATX_LockSize,    TRUE,
  756.                         TAG_DONE);
  757.  
  758.                         LT_New(Handle,
  759.                             LA_Type,    TEXT_KIND,
  760.                             LA_LabelID,    MSG_SCREENPANEL_SCREEN_FONT_GAD,
  761.                             LA_Chars,    20,
  762.                             LA_ID,        GAD_FONT,
  763.                             GTTX_Text,    FontName,
  764.                             GTTX_Border,    TRUE,
  765.                             LATX_Picker,    TRUE,
  766.                             LATX_LockSize,    TRUE,
  767.                         TAG_DONE);
  768.  
  769.                         LT_EndGroup(Handle);
  770.                     }
  771.  
  772.                     LT_New(Handle,
  773.                         LA_Type,    VERTICAL_KIND,
  774.                     TAG_DONE);
  775.                     {
  776.                         if(Kick30)
  777.                         {
  778.                             LT_New(Handle,
  779.                                 LA_Type,    CHECKBOX_KIND,
  780.                                 LA_LabelID,    MSG_SCREENPANEL_FASTER_LAYOUT_GAD,
  781.                                 LA_BYTE,    &LocalConfig -> ScreenConfig -> FasterLayout,
  782.                             TAG_DONE);
  783.                         }
  784.  
  785.                         LT_New(Handle,
  786.                             LA_Type,    CHECKBOX_KIND,
  787.                             LA_LabelID,    MSG_SCREENPANEL_MAKE_SCREEN_PUBLIC_GAD,
  788.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> MakeScreenPublic,
  789.                             LA_ID,        GAD_MAKESCREENPUBLIC,
  790.                             GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench,
  791.                         TAG_DONE);
  792.  
  793.                         LT_New(Handle,
  794.                             LA_Type,    CHECKBOX_KIND,
  795.                             LA_ID,        GAD_SHANGHAI,
  796.                             LA_LabelID,    MSG_SCREENPANEL_SHANGHAI_WINDOWS_GAD,
  797.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> ShanghaiWindows,
  798.                             GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench,
  799.                         TAG_DONE);
  800.  
  801.                         LT_EndGroup(Handle);
  802.                     }
  803.  
  804.                     LT_New(Handle,
  805.                         LA_Type,    VERTICAL_KIND,
  806.                     TAG_DONE);
  807.                     {
  808.                         LT_New(Handle,
  809.                             LA_Type,    XBAR_KIND,
  810.                         TAG_DONE);
  811.  
  812.                         LT_New(Handle,
  813.                             LA_Type,    CHECKBOX_KIND,
  814.                             LA_ID,        GAD_USE_PUBSCREEN,
  815.                             LA_LabelID,    MSG_SCREENPANEL_USE_WORKBENCH_GAD,
  816.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> UseWorkbench,
  817.                         TAG_DONE);
  818.  
  819.                         LT_EndGroup(Handle);
  820.                     }
  821.  
  822.                     LT_New(Handle,
  823.                         LA_Type,    VERTICAL_KIND,
  824.                     TAG_DONE);
  825.                     {
  826.                         LT_New(Handle,
  827.                             LA_Type,    STRING_KIND,
  828.                             LA_LabelID,    MSG_SCREENPANEL_PUBSCREEN_NAME_GAD,
  829.                             LA_ID,        GAD_PUBSCREENNAME,
  830.                             LA_STRPTR,    LocalConfig -> ScreenConfig -> PubScreenName,
  831.                             LA_Chars,    14,
  832.                             GTST_MaxChars,    MAXPUBSCREENNAME,
  833.                             LAST_Picker,    TRUE,
  834.                             GA_Disabled,    !LocalConfig -> ScreenConfig -> UseWorkbench,
  835.                         TAG_DONE);
  836.  
  837.                         LT_EndGroup(Handle);
  838.                     }
  839.  
  840.                     LT_EndGroup(Handle);
  841.                 }
  842.  
  843.                 LT_New(Handle,
  844.                     LA_Type,    VERTICAL_KIND,
  845.                 TAG_DONE);
  846.                 {
  847.                     LT_New(Handle,
  848.                         LA_Type,    VERTICAL_KIND,
  849.                     TAG_DONE);
  850.                     {
  851.                         LT_New(Handle,
  852.                             LA_Type,    CHECKBOX_KIND,
  853.                             LA_LabelID,    MSG_SCREENPANEL_SCREEN_TITLE_GAD,
  854.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> TitleBar,
  855.                             LA_ID,        GAD_SCREENTITLE,
  856.                             GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench,
  857.                         TAG_DONE);
  858.  
  859.                         LT_New(Handle,
  860.                             LA_Type,    CHECKBOX_KIND,
  861.                             LA_LabelID,    MSG_SCREENPANEL_WINDOW_BORDER_TXT,
  862.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> ShareScreen,
  863.                             LA_ID,        GAD_WINDOW_BORDER,
  864.                             GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench,
  865.                         TAG_DONE);
  866.  
  867.                         LT_New(Handle,
  868.                             LA_Type,    XBAR_KIND,
  869.                         TAG_DONE);
  870.  
  871.                         LocalConfig -> ScreenConfig -> StatusLine &= 0xF;
  872.  
  873.                         LT_New(Handle,
  874.                             LA_Type,    CHECKBOX_KIND,
  875.                             LA_LabelID,    MSG_SCREENPANEL_SEPARATE_STATUS_WINDOW_TXT,
  876.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> SplitStatus,
  877.                             LA_ID,        GAD_SPLIT_STATUS,
  878.                             GA_Disabled,    !LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),
  879.                         TAG_DONE);
  880.  
  881.                         LT_EndGroup(Handle);
  882.                     }
  883.  
  884.                     LT_New(Handle,
  885.                         LA_Type,    VERTICAL_KIND,
  886.                     TAG_DONE);
  887.                     {
  888.                         LT_New(Handle,
  889.                             LA_Type,    CYCLE_KIND,
  890.                             LA_LabelID,    MSG_SCREENPANEL_STATUS_LINE_GAD,
  891.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> StatusLine,
  892.                             LACY_FirstLabel,MSG_SCREENPANEL_STATUS_DISABLED_TXT,
  893.                             LACY_LastLabel,    MSG_SCREENPANEL_STATUS_COMPACT_TXT,
  894.                             LA_ID,        GAD_STATUS_LINE,
  895.                         TAG_DONE);
  896.  
  897.                         LT_New(Handle,
  898.                             LA_Type,    CYCLE_KIND,
  899.                             LA_LabelID,    MSG_SCREENPANEL_ONLINE_TIME_GAD,
  900.                             LA_BYTE,    &LocalConfig -> ScreenConfig -> TimeMode,
  901.                             LACY_FirstLabel,MSG_SCREENPANEL_TIME_ONLINETIME_TXT,
  902.                             LACY_LastLabel,    MSG_SCREENPANEL_TIME_BOTH_TXT,
  903.                         TAG_DONE);
  904.  
  905.                         LT_EndGroup(Handle);
  906.                     }
  907.  
  908.                     LT_EndGroup(Handle);
  909.                 }
  910.  
  911.                 LT_New(Handle,
  912.                     LA_Type,    VERTICAL_KIND,
  913.                 TAG_DONE);
  914.                 {
  915.                     LT_New(Handle,
  916.                         LA_Type,    MX_KIND,
  917.                         LA_LabelID,    MSG_SCREENPANEL_COLOUR_GAD,
  918.                         LA_WORD,    &LocalConfig -> ScreenConfig -> ColourMode,
  919.                         LA_ID,        GAD_COLOURMODE,
  920.                         LAMX_FirstLabel,MSG_SCREENPANEL_COLOUR_AMIGA_TXT,
  921.                         LAMX_LastLabel,    MSG_SCREENPANEL_COLOUR_MONO_TXT,
  922.                     TAG_DONE);
  923.  
  924.                     LT_New(Handle,
  925.                         LA_Type,    CHECKBOX_KIND,
  926.                         LA_LabelID,    MSG_SCREENPANEL_BLINKING_GAD,
  927.                         LA_ID,        GAD_BLINKING,
  928.                         LA_BYTE,    &LocalConfig -> ScreenConfig -> Blinking,
  929.                         GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_MONO,
  930.                         LA_ExtraSpace,    TRUE,
  931.                     TAG_DONE);
  932.  
  933.                     LT_EndGroup(Handle);
  934.                 }
  935.  
  936.                 if(Screen && LocalConfig -> ScreenConfig -> ColourMode == Config -> ScreenConfig -> ColourMode)
  937.                 {
  938.                     LT_New(Handle,
  939.                         LA_Type,    VERTICAL_KIND,
  940.                     TAG_DONE);
  941.                     {
  942.                         LONG Depth;
  943.  
  944.                         switch(LocalConfig -> ScreenConfig -> ColourMode)
  945.                         {
  946.                             case COLOUR_MONO:
  947.  
  948.                                 Depth = 1;
  949.                                 break;
  950.  
  951.                             case COLOUR_AMIGA:
  952.  
  953.                                 Depth = 2;
  954.                                 break;
  955.  
  956.                             case COLOUR_EIGHT:
  957.  
  958.                                 Depth = 3;
  959.                                 break;
  960.  
  961.                             case COLOUR_SIXTEEN:
  962.  
  963.                                 Depth = 4;
  964.                                 break;
  965.                         }
  966.  
  967.                         if(LocalConfig -> ScreenConfig -> UseWorkbench)
  968.                         {
  969.                             LONG i,MaxDepth = 4;
  970.  
  971.                             for(i = 0 ; i < 4 ; i++)
  972.                             {
  973.                                 if((1L << i) > Window -> WScreen -> ViewPort . ColorMap -> Count)
  974.                                 {
  975.                                     MaxDepth = i;
  976.  
  977.                                     break;
  978.                                 }
  979.                             }
  980.  
  981.                             if(Depth > MaxDepth)
  982.                                 Depth = MaxDepth;
  983.                         }
  984.  
  985.                         LT_New(Handle,
  986.                             LA_Type,    VERTICAL_KIND,
  987.                         TAG_DONE);
  988.                         {
  989.                             WORD    ColourMax;
  990.                             STRPTR    ColourFormat;
  991.  
  992.                             if(Kick30)
  993.                             {
  994.                                 ColourMax    = 255;
  995.                                 ColourFormat    = "%3ld";
  996.                             }
  997.                             else
  998.                             {
  999.                                 ColourMax    = 15;
  1000.                                 ColourFormat    = "%2ld";
  1001.                             }
  1002.  
  1003.                             LT_New(Handle,
  1004.                                 LA_Type,    PALETTE_KIND,
  1005.                                 LA_LabelID,    MSG_SCREENPANEL_EDIT_SCREEN_PALETTE_GAD,
  1006.                                 LA_ID,        GAD_PALETTE,
  1007.                                 LA_Chars,    12,
  1008.                                 GTPA_Depth,    Depth,
  1009.                                 GA_Disabled,    WrongMode,
  1010.                             TAG_DONE);
  1011.  
  1012.                             LT_New(Handle,
  1013.                                 LA_Type,        SliderType,
  1014.                                 LA_LabelID,        MSG_SCREENPANEL_RED_GAD,
  1015.                                 LA_ID,            GAD_RED,
  1016.                                 GTSL_Min,        0,
  1017.                                 GTSL_Max,        ColourMax,
  1018.                                 GTSL_Level,        0,
  1019.                                 GTSL_LevelFormat,    ColourFormat,
  1020.                                 GA_Disabled,        WrongMode,
  1021.                             TAG_DONE);
  1022.  
  1023.                             LT_New(Handle,
  1024.                                 LA_Type,        SliderType,
  1025.                                 LA_LabelID,        MSG_SCREENPANEL_GREEN_GAD,
  1026.                                 LA_ID,            GAD_GREEN,
  1027.                                 GTSL_Min,        0,
  1028.                                 GTSL_Max,        ColourMax,
  1029.                                 GTSL_Level,        0,
  1030.                                 GTSL_LevelFormat,    ColourFormat,
  1031.                                 GA_Disabled,        WrongMode,
  1032.                             TAG_DONE);
  1033.  
  1034.                             LT_New(Handle,
  1035.                                 LA_Type,        SliderType,
  1036.                                 LA_LabelID,        MSG_SCREENPANEL_BLUE_GAD,
  1037.                                 LA_ID,            GAD_BLUE,
  1038.                                 GTSL_Min,        0,
  1039.                                 GTSL_Max,        ColourMax,
  1040.                                 GTSL_Level,        0,
  1041.                                 GTSL_LevelFormat,    ColourFormat,
  1042.                                 GA_Disabled,        WrongMode,
  1043.                             TAG_DONE);
  1044.  
  1045.                             LT_New(Handle,
  1046.                                 LA_Type,        XBAR_KIND,
  1047.                             TAG_DONE);
  1048.  
  1049.                             LT_EndGroup(Handle);
  1050.                         }
  1051.  
  1052.                         LT_New(Handle,
  1053.                             LA_Type,    VERTICAL_KIND,
  1054.                         TAG_DONE);
  1055.                         {
  1056.                             LT_New(Handle,
  1057.                                 LA_Type,    BUTTON_KIND,
  1058.                                 LA_LabelID,    MSG_SCREENPANEL_USE_DEFAULT_TXT,
  1059.                                 LA_ID,        GAD_RESET,
  1060.                                 LA_Chars,    16,
  1061.                                 GA_Disabled,    WrongMode,
  1062.                             TAG_DONE);
  1063.  
  1064.                             LT_EndGroup(Handle);
  1065.                         }
  1066.  
  1067.                         LT_EndGroup(Handle);
  1068.                     }
  1069.  
  1070.                     if(Kick30)
  1071.                     {
  1072.                         LT_New(Handle,
  1073.                             LA_Type,    VERTICAL_KIND,
  1074.                         TAG_DONE);
  1075.                         {
  1076.                             LT_New(Handle,
  1077.                                 LA_Type,    VERTICAL_KIND,
  1078.                             TAG_DONE);
  1079.                             {
  1080.                                 LT_New(Handle,
  1081.                                     LA_Type,    CHECKBOX_KIND,
  1082.                                     LA_LabelID,    MSG_PENPANEL_STANDARDPENS_TXT,
  1083.                                     LA_ID,        GAD_STDPENS,
  1084.                                     LA_BYTE,    &LocalConfig -> ScreenConfig -> UsePens,
  1085.                                     GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1086.                                 TAG_DONE);
  1087.  
  1088.                                 LT_EndGroup(Handle);
  1089.                             }
  1090.  
  1091.                             LT_New(Handle,
  1092.                                 LA_Type,    VERTICAL_KIND,
  1093.                             TAG_DONE);
  1094.                             {
  1095.                                 LT_New(Handle,
  1096.                                     LA_Type,    BUTTON_KIND,
  1097.                                     LA_LabelID,    MSG_PENPANEL_EDITPENS_TXT,
  1098.                                     LA_ID,        GAD_EDITPENS,
  1099.                                     GA_Disabled,    LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1100.                                 TAG_DONE);
  1101.  
  1102.                                 LT_EndGroup(Handle);
  1103.                             }
  1104.  
  1105.                             LT_EndGroup(Handle);
  1106.                         }
  1107.                     }
  1108.                 }
  1109.  
  1110.                 LT_EndGroup(Handle);
  1111.             }
  1112.  
  1113.             LT_New(Handle,
  1114.                 LA_Type,    VERTICAL_KIND,
  1115.             TAG_DONE);
  1116.             {
  1117.                 LT_New(Handle,LA_Type,XBAR_KIND,LAXB_FullSize,TRUE,TAG_DONE);
  1118.  
  1119.                 LT_EndGroup(Handle);
  1120.             }
  1121.  
  1122.             LT_New(Handle,LA_Type,HORIZONTAL_KIND,
  1123.                 LAGR_SameSize,    TRUE,
  1124.                 LAGR_Spread,    TRUE,
  1125.             TAG_DONE);
  1126.             {
  1127.                 LT_New(Handle,
  1128.                     LA_Type,    BUTTON_KIND,
  1129.                     LA_LabelID,    MSG_GLOBAL_USE_GAD,
  1130.                     LA_ID,        GAD_USE,
  1131.                     LABT_ReturnKey,    TRUE,
  1132.                     LABT_ExtraFat,    TRUE,
  1133.                 TAG_DONE);
  1134.  
  1135.                 if(Default)
  1136.                 {
  1137.                     LT_New(Handle,
  1138.                         LA_Type,    BUTTON_KIND,
  1139.                         LA_LabelID,    MSG_GLOBAL_DEFAULT_GAD,
  1140.                         LA_ID,        GAD_DEFAULT,
  1141.                         LABT_ExtraFat,    TRUE,
  1142.                     TAG_DONE);
  1143.                 }
  1144.  
  1145.                 LT_New(Handle,
  1146.                     LA_Type,    BUTTON_KIND,
  1147.                     LA_LabelID,    MSG_GLOBAL_CANCEL_GAD,
  1148.                     LA_ID,        GAD_CANCEL,
  1149.                     LABT_EscKey,    TRUE,
  1150.                     LABT_ExtraFat,    TRUE,
  1151.                 TAG_DONE);
  1152.  
  1153.                 LT_EndGroup(Handle);
  1154.             }
  1155.  
  1156.             LT_EndGroup(Handle);
  1157.         }
  1158.  
  1159.         if(LocalWindow = LT_Layout(Handle,LocaleString(MSG_SCREENPANEL_SCREEN_PREFERENCES_TXT),NULL,0,0,IDCMP_CLOSEWINDOW,0,
  1160.             LAWN_HelpHook,        &GuideHook,
  1161.             LAWN_Parent,        Window,
  1162.             WA_DepthGadget,        TRUE,
  1163.             WA_CloseGadget,        TRUE,
  1164.             WA_DragBar,        TRUE,
  1165.             WA_RMBTrap,        TRUE,
  1166.             WA_Activate,        TRUE,
  1167.         TAG_DONE))
  1168.         {
  1169.             struct IntuiMessage    *Message;
  1170.             BOOLEAN             Done = FALSE;
  1171.             ULONG             MsgClass,
  1172.                          MsgQualifier;
  1173.             UWORD             MsgCode;
  1174.             struct Gadget        *MsgGadget;
  1175.  
  1176.             WORD             ColourNumber = 0,Count,i;
  1177.             WORD             Red,Green,Blue;
  1178.             struct ViewPort        *LocalVPort = &LocalWindow -> WScreen -> ViewPort;
  1179.  
  1180.             UWORD            *DefaultPens,Depth;
  1181.  
  1182.             switch(LocalConfig -> ScreenConfig -> ColourMode)
  1183.             {
  1184.                 case COLOUR_MONO:
  1185.  
  1186.                     DefaultPens = MonoPens;
  1187.                     Depth = 1;
  1188.                     break;
  1189.  
  1190.                 case COLOUR_AMIGA:
  1191.  
  1192.                     DefaultPens = StandardPens;
  1193.                     Depth = 2;
  1194.                     break;
  1195.  
  1196.                 case COLOUR_EIGHT:
  1197.  
  1198.                     DefaultPens = ANSIPens;
  1199.                     Depth = 3;
  1200.                     break;
  1201.  
  1202.                 case COLOUR_SIXTEEN:
  1203.  
  1204.                     if(IntuitionBase -> LibNode . lib_Version >= 39)
  1205.                         DefaultPens = NewEGAPens;
  1206.                     else
  1207.                         DefaultPens = EGAPens;
  1208.  
  1209.                     Depth = 4;
  1210.                     break;
  1211.             }
  1212.  
  1213.             for(Count = 0, i = DETAILPEN ; i <= BARTRIMPEN ; i++)
  1214.             {
  1215.                 if(LocalConfig -> ScreenConfig -> PenArray[i])
  1216.                     Count++;
  1217.             }
  1218.  
  1219.             if(!Count)
  1220.                 CopyMem(DefaultPens,LocalConfig -> ScreenConfig -> PenArray,16 * sizeof(UWORD));
  1221.  
  1222.             LocalConfig -> ScreenConfig -> DisplayMode = DisplayMode;
  1223.  
  1224.             if(!WrongMode)
  1225.             {
  1226.                 if(Kick30)
  1227.                 {
  1228.                     Red    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] >> 24;
  1229.                     Green    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] >> 24;
  1230.                     Blue    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] >> 24;
  1231.                 }
  1232.                 else
  1233.                 {
  1234.                     Red    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 8) & 0xF;
  1235.                     Green    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 4) & 0xF;
  1236.                     Blue    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber]     ) & 0xF;
  1237.                 }
  1238.  
  1239.                 LT_SetAttributes(Handle,GAD_RED,    GTSL_Level,    Red,    TAG_DONE);
  1240.                 LT_SetAttributes(Handle,GAD_GREEN,    GTSL_Level,    Green,    TAG_DONE);
  1241.                 LT_SetAttributes(Handle,GAD_BLUE,    GTSL_Level,    Blue,    TAG_DONE);
  1242.  
  1243.                 if(Screen)
  1244.                 {
  1245.                     LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1246.                     LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1247.                 }
  1248.             }
  1249.  
  1250.             GuideContext(CONTEXT_SCREEN);
  1251.  
  1252.             PushWindow(LocalWindow);
  1253.  
  1254.             LT_ShowWindow(Handle,TRUE);
  1255.  
  1256.             do
  1257.             {
  1258.                 if(Wait(PORTMASK(LocalWindow -> UserPort) | SIG_BREAK) & SIG_BREAK)
  1259.                 {
  1260.                     SaveConfig(PrivateConfig,LocalConfig);
  1261.  
  1262.                     if(!Config -> ScreenConfig -> UseWorkbench && Screen)
  1263.                     {
  1264.                         if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
  1265.                             PaletteSetup(LocalConfig);
  1266.                         else
  1267.                             PaletteSetup(Config);
  1268.  
  1269.                         LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1270.                         LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1271.                     }
  1272.  
  1273.                     break;
  1274.                 }
  1275.  
  1276.                 while(Message = (struct IntuiMessage *)LT_GetIMsg(Handle))
  1277.                 {
  1278.                     MsgClass    = Message -> Class;
  1279.                     MsgQualifier    = Message -> Qualifier;
  1280.                     MsgCode        = Message -> Code;
  1281.                     MsgGadget    = (struct Gadget *)Message -> IAddress;
  1282.  
  1283.                     LT_ReplyIMsg(Message);
  1284.  
  1285.                     if(MsgClass == IDCMP_CLOSEWINDOW)
  1286.                     {
  1287.                         SaveConfig(PrivateConfig,LocalConfig);
  1288.  
  1289.                         if(!Config -> ScreenConfig -> UseWorkbench && Screen)
  1290.                         {
  1291.                             if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
  1292.                                 PaletteSetup(LocalConfig);
  1293.                             else
  1294.                                 PaletteSetup(Config);
  1295.  
  1296.                             LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1297.                             LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1298.                         }
  1299.  
  1300.                         Done = TRUE;
  1301.                     }
  1302.  
  1303.                     if(MsgClass == IDCMP_MOUSEMOVE)
  1304.                     {
  1305.                         switch(MsgGadget -> GadgetID)
  1306.                         {
  1307.                             case GAD_RED:
  1308.  
  1309.                                 Red = MsgCode;
  1310.  
  1311.                                 if(Kick30)
  1312.                                     LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] = SPREAD(Red);
  1313.                                 else
  1314.                                     LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] = SPREAD((Red << 4) | Red);
  1315.  
  1316.                                 PaletteSetup(LocalConfig);
  1317.  
  1318.                                 LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1319.                                 LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1320.  
  1321.                                 break;
  1322.  
  1323.                             case GAD_GREEN:
  1324.  
  1325.                                 Green = MsgCode;
  1326.  
  1327.                                 if(Kick30)
  1328.                                     LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] = SPREAD(Green);
  1329.                                 else
  1330.                                     LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] = SPREAD((Green << 4) | Green);
  1331.  
  1332.                                 PaletteSetup(LocalConfig);
  1333.  
  1334.                                 LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1335.                                 LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1336.  
  1337.                                 break;
  1338.  
  1339.                             case GAD_BLUE:
  1340.  
  1341.                                 Blue = MsgCode;
  1342.  
  1343.                                 if(Kick30)
  1344.                                     LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] = SPREAD(Blue);
  1345.                                 else
  1346.                                     LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] = SPREAD((Blue << 4) | Blue);
  1347.  
  1348.                                 PaletteSetup(LocalConfig);
  1349.  
  1350.                                 LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1351.                                 LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1352.  
  1353.                                 break;
  1354.                         }
  1355.                     }
  1356.  
  1357.                     if(MsgClass == IDCMP_GADGETUP)
  1358.                     {
  1359.                         switch(MsgGadget -> GadgetID)
  1360.                         {
  1361.                             case GAD_STDPENS:
  1362.  
  1363.                                 LT_SetAttributes(Handle,GAD_EDITPENS,
  1364.                                     GA_Disabled,LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1365.                                 TAG_DONE);
  1366.  
  1367.                                 break;
  1368.  
  1369.                             case GAD_USE_PUBSCREEN:
  1370.  
  1371.                                 LT_SetAttributes(Handle,GAD_PUBSCREENNAME,GA_Disabled,!LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
  1372.                                 LT_SetAttributes(Handle,GAD_MAKESCREENPUBLIC,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
  1373.                                 LT_SetAttributes(Handle,GAD_SHANGHAI,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
  1374.                                 LT_SetAttributes(Handle,GAD_SCREENTITLE,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
  1375.                                 LT_SetAttributes(Handle,GAD_WINDOW_BORDER,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench,TAG_DONE);
  1376.                                 LT_SetAttributes(Handle,GAD_BLINKING,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_MONO,TAG_DONE);
  1377.                                 LT_SetAttributes(Handle,GAD_SPLIT_STATUS,GA_Disabled,!LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),TAG_DONE);
  1378.  
  1379.                                 WrongMode = IsWrongMode(LocalConfig,PrivateConfig -> ScreenConfig -> ColourMode);
  1380.  
  1381.                                 LT_SetAttributes(Handle,GAD_PALETTE,GA_Disabled,WrongMode,TAG_DONE);
  1382.                                 LT_SetAttributes(Handle,GAD_RED,GA_Disabled,WrongMode,TAG_DONE);
  1383.                                 LT_SetAttributes(Handle,GAD_GREEN,GA_Disabled,WrongMode,TAG_DONE);
  1384.                                 LT_SetAttributes(Handle,GAD_BLUE,GA_Disabled,WrongMode,TAG_DONE);
  1385.                                 LT_SetAttributes(Handle,GAD_RESET,GA_Disabled,WrongMode,TAG_DONE);
  1386.  
  1387.                                 LT_SetAttributes(Handle,GAD_EDITPENS,
  1388.                                     GA_Disabled,    LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1389.                                 TAG_DONE);
  1390.  
  1391.                                 LT_SetAttributes(Handle,GAD_STDPENS,
  1392.                                     GTCB_Checked,    LocalConfig -> ScreenConfig -> UsePens = TRUE,
  1393.                                     GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1394.                                 TAG_DONE);
  1395.  
  1396.                                 break;
  1397.  
  1398.                             case GAD_WINDOW_BORDER:
  1399.  
  1400.                                 LT_SetAttributes(Handle,GAD_SPLIT_STATUS,GA_Disabled,!LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),TAG_DONE);
  1401.                                 break;
  1402.  
  1403.                             case GAD_COLOURMODE:
  1404.  
  1405.                                 if(!ModeOkay(LocalConfig -> ScreenConfig -> DisplayMode) && LocalConfig -> ScreenConfig -> ColourMode > COLOUR_AMIGA)
  1406.                                     LT_SetAttributes(Handle,GAD_COLOURMODE,GTCY_Active,COLOUR_AMIGA,TAG_DONE);
  1407.  
  1408.                                 WrongMode = IsWrongMode(LocalConfig,PrivateConfig -> ScreenConfig -> ColourMode);
  1409.  
  1410.                                 LT_SetAttributes(Handle,GAD_PALETTE,    GA_Disabled,WrongMode,TAG_DONE);
  1411.                                 LT_SetAttributes(Handle,GAD_RED,    GA_Disabled,WrongMode,TAG_DONE);
  1412.                                 LT_SetAttributes(Handle,GAD_GREEN,    GA_Disabled,WrongMode,TAG_DONE);
  1413.                                 LT_SetAttributes(Handle,GAD_BLUE,    GA_Disabled,WrongMode,TAG_DONE);
  1414.                                 LT_SetAttributes(Handle,GAD_RESET,    GA_Disabled,WrongMode,TAG_DONE);
  1415.  
  1416.                                 LT_SetAttributes(Handle,GAD_BLINKING,GA_Disabled,LocalConfig -> ScreenConfig -> UseWorkbench || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_MONO,TAG_DONE);
  1417.  
  1418.                                 switch(LocalConfig -> ScreenConfig -> ColourMode)
  1419.                                 {
  1420.                                     case COLOUR_MONO:
  1421.  
  1422.                                         DefaultPens = MonoPens;
  1423.                                         Depth = 1;
  1424.                                         break;
  1425.  
  1426.                                     case COLOUR_AMIGA:
  1427.  
  1428.                                         DefaultPens = StandardPens;
  1429.                                         Depth = 2;
  1430.                                         break;
  1431.  
  1432.                                     case COLOUR_EIGHT:
  1433.  
  1434.                                         DefaultPens = ANSIPens;
  1435.                                         Depth = 3;
  1436.                                         break;
  1437.  
  1438.                                     case COLOUR_SIXTEEN:
  1439.  
  1440.                                         DefaultPens = EGAPens;
  1441.                                         Depth = 4;
  1442.                                         break;
  1443.                                 }
  1444.  
  1445.                                 LT_SetAttributes(Handle,GAD_EDITPENS,
  1446.                                     GA_Disabled,    LocalConfig -> ScreenConfig -> UsePens || LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1447.                                 TAG_DONE);
  1448.  
  1449.                                 LT_SetAttributes(Handle,GAD_STDPENS,
  1450.                                     GA_Disabled,    LocalConfig -> ScreenConfig -> UseWorkbench || WrongMode,
  1451.                                 TAG_DONE);
  1452.  
  1453.                                 break;
  1454.  
  1455.                             case GAD_EDITPENS:
  1456.  
  1457.                                 LT_LockWindow(LocalWindow);
  1458.  
  1459.                                 if(LocalConfig -> ScreenConfig -> PenColourMode != LocalConfig -> ScreenConfig -> ColourMode)
  1460.                                 {
  1461.                                     UWORD LocalPens[16];
  1462.  
  1463.                                     CopyMem(DefaultPens,LocalPens,16 * sizeof(UWORD));
  1464.  
  1465.                                     if(PenPanel(LocalWindow,LocalPens,DefaultPens,Depth))
  1466.                                     {
  1467.                                         CopyMem(LocalPens,LocalConfig -> ScreenConfig -> PenArray,16 * sizeof(UWORD));
  1468.  
  1469.                                         LocalConfig -> ScreenConfig -> PenColourMode = LocalConfig -> ScreenConfig -> ColourMode;
  1470.                                     }
  1471.                                 }
  1472.                                 else
  1473.                                     PenPanel(LocalWindow,LocalConfig -> ScreenConfig -> PenArray,DefaultPens,Depth);
  1474.  
  1475.                                 LT_UnlockWindow(LocalWindow);
  1476.  
  1477.                                 LT_ShowWindow(Handle,TRUE);
  1478.                                 break;
  1479.  
  1480.                             case GAD_MAKESCREENPUBLIC:
  1481.  
  1482.                                 LT_SetAttributes(Handle,GAD_SHANGHAI,
  1483.                                     GA_Disabled,    !LocalConfig -> ScreenConfig -> MakeScreenPublic || LocalConfig -> ScreenConfig -> UseWorkbench,
  1484.                                 TAG_DONE);
  1485.  
  1486.                                 break;
  1487.  
  1488.                             case GAD_PALETTE:
  1489.  
  1490.                                 ColourNumber = MsgCode;
  1491.  
  1492.                                 if(Kick30)
  1493.                                 {
  1494.                                     Red    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] >> 24;
  1495.                                     Green    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] >> 24;
  1496.                                     Blue    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] >> 24;
  1497.                                 }
  1498.                                 else
  1499.                                 {
  1500.                                     Red    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 8) & 0xF;
  1501.                                     Green    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 4) & 0xF;
  1502.                                     Blue    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber]     ) & 0xF;
  1503.                                 }
  1504.  
  1505.                                 LT_SetAttributes(Handle,GAD_RED,    GTSL_Level,    Red,    TAG_DONE);
  1506.                                 LT_SetAttributes(Handle,GAD_GREEN,    GTSL_Level,    Green,    TAG_DONE);
  1507.                                 LT_SetAttributes(Handle,GAD_BLUE,    GTSL_Level,    Blue,    TAG_DONE);
  1508.  
  1509.                                 break;
  1510.  
  1511.                             case GAD_RESET:
  1512.  
  1513.                                 Default2CurrentPalette(LocalConfig);
  1514.  
  1515.                                 if(Kick30)
  1516.                                 {
  1517.                                     Red    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 0] >> 24;
  1518.                                     Green    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 1] >> 24;
  1519.                                     Blue    = LocalConfig -> ScreenConfig -> Colours96[ColourNumber * 3 + 2] >> 24;
  1520.                                 }
  1521.                                 else
  1522.                                 {
  1523.                                     Red    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 8) & 0xF;
  1524.                                     Green    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber] >> 4) & 0xF;
  1525.                                     Blue    = (LocalConfig -> ScreenConfig -> Colours[ColourNumber]     ) & 0xF;
  1526.                                 }
  1527.  
  1528.                                 LT_SetAttributes(Handle,GAD_RED,    GTSL_Level,    Red,    TAG_DONE);
  1529.                                 LT_SetAttributes(Handle,GAD_GREEN,    GTSL_Level,    Green,    TAG_DONE);
  1530.                                 LT_SetAttributes(Handle,GAD_BLUE,    GTSL_Level,    Blue,    TAG_DONE);
  1531.  
  1532.                                 PaletteSetup(LocalConfig);
  1533.  
  1534.                                 LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1535.                                 LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1536.  
  1537.                                 break;
  1538.  
  1539.                             case GAD_USE:
  1540.  
  1541.                                 LT_UpdateStrings(Handle);
  1542.  
  1543.                                 if(!WrongMode)
  1544.                                     PaletteSetup(LocalConfig);
  1545.                                 else
  1546.                                 {
  1547.                                     if(LocalConfig -> ScreenConfig -> ColourMode != PrivateConfig -> ScreenConfig -> ColourMode)
  1548.                                         Default2CurrentPalette(LocalConfig);
  1549.                                 }
  1550.  
  1551.                                 if(LocalConfig -> ScreenConfig -> PenColourMode != LocalConfig -> ScreenConfig -> ColourMode)
  1552.                                 {
  1553.                                     CopyMem(DefaultPens,LocalConfig -> ScreenConfig -> PenArray,16 * sizeof(UWORD));
  1554.  
  1555.                                     LocalConfig -> ScreenConfig -> PenColourMode = LocalConfig -> ScreenConfig -> ColourMode;
  1556.                                 }
  1557.  
  1558.                                 Done = TRUE;
  1559.                                 break;
  1560.  
  1561.                             case GAD_CANCEL:
  1562.  
  1563.                                 SaveConfig(PrivateConfig,LocalConfig);
  1564.  
  1565.                                 if(!Config -> ScreenConfig -> UseWorkbench && Screen)
  1566.                                 {
  1567.                                     if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
  1568.                                         PaletteSetup(LocalConfig);
  1569.                                     else
  1570.                                         PaletteSetup(Config);
  1571.  
  1572.                                     LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1573.                                     LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1574.                                 }
  1575.  
  1576.                                 Cancel = Done = TRUE;
  1577.                                 break;
  1578.  
  1579.                             case GAD_DEFAULT:
  1580.  
  1581.                                 *Default = TRUE;
  1582.  
  1583.                                 SaveConfig(PrivateConfig,LocalConfig);
  1584.  
  1585.                                 if(!Config -> ScreenConfig -> UseWorkbench && Screen)
  1586.                                 {
  1587.                                     if(!memcmp(Config -> ScreenConfig -> Colours96,LocalConfig -> ScreenConfig -> Colours96,sizeof(ULONG) * 3 * 16))
  1588.                                         PaletteSetup(LocalConfig);
  1589.                                     else
  1590.                                         PaletteSetup(Config);
  1591.  
  1592.                                     LoadColourTable(VPort,        NormalColourTable,NormalColours,PaletteSize);
  1593.                                     LoadColourTable(LocalVPort,    NormalColourTable,NormalColours,PaletteSize);
  1594.                                 }
  1595.  
  1596.                                 Done = TRUE;
  1597.                                 break;
  1598.                         }
  1599.                     }
  1600.  
  1601.                     if(MsgClass == IDCMP_IDCMPUPDATE)
  1602.                     {
  1603.                         switch(MsgGadget -> GadgetID)
  1604.                         {
  1605.                             case GAD_FONT:
  1606.  
  1607.                                 LT_LockWindow(LocalWindow);
  1608.  
  1609.                                 if(PickFont(LocalWindow,LocalConfig -> ScreenConfig -> FontName,&LocalConfig -> ScreenConfig -> FontHeight,FALSE))
  1610.                                 {
  1611.                                     BuildFontName(FontName,LocalConfig -> ScreenConfig -> FontName,LocalConfig -> ScreenConfig -> FontHeight);
  1612.  
  1613.                                     LT_SetAttributes(Handle,GAD_FONT,
  1614.                                         GTTX_Text,    FontName,
  1615.                                     TAG_DONE);
  1616.                                 }
  1617.  
  1618.                                 LT_UnlockWindow(LocalWindow);
  1619.  
  1620.                                 break;
  1621.  
  1622.                             case GAD_SCREENMODE:
  1623.  
  1624.                                 LT_LockWindow(LocalWindow);
  1625.  
  1626.                                 if(SelectDisplayMode(LocalWindow,&LocalConfig -> ScreenConfig -> DisplayMode,LocalConfig))
  1627.                                 {
  1628.                                     strcpy(ModeName,GetModeName(LocalConfig -> ScreenConfig -> DisplayMode));
  1629.  
  1630.                                     LT_SetAttributes(Handle,GAD_SCREENMODE,GTTX_Text,ModeName,TAG_DONE);
  1631.                                 }
  1632.  
  1633.                                 LT_UnlockWindow(LocalWindow);
  1634.  
  1635.                                 LT_ShowWindow(Handle,TRUE);
  1636.  
  1637.                                 break;
  1638.  
  1639.                             case GAD_STATUS_LINE:
  1640.  
  1641.                                 LT_SetAttributes(Handle,GAD_SPLIT_STATUS,GA_Disabled,!LocalConfig -> ScreenConfig -> StatusLine || (!LocalConfig -> ScreenConfig -> ShareScreen && !LocalConfig -> ScreenConfig -> UseWorkbench),TAG_DONE);
  1642.  
  1643.                                 break;
  1644.  
  1645.                             case GAD_PUBSCREENNAME:
  1646.  
  1647.                                 if(LocalConfig -> ScreenConfig -> UseWorkbench)
  1648.                                 {
  1649.                                     UBYTE DummyBuffer[MAXPUBSCREENNAME + 1];
  1650.  
  1651.                                     LT_LockWindow(LocalWindow);
  1652.  
  1653.                                     strcpy(DummyBuffer,(STRPTR)LT_GetAttributes(Handle,GAD_PUBSCREENNAME,TAG_DONE));
  1654.                                     strcpy(SharedBuffer,DummyBuffer);
  1655.  
  1656.                                     if(PickScreen(LocalWindow,DummyBuffer))
  1657.                                     {
  1658.                                         if(strcmp(DummyBuffer,SharedBuffer))
  1659.                                             LT_SetAttributes(Handle,GAD_PUBSCREENNAME,GTST_String,DummyBuffer,TAG_DONE);
  1660.                                     }
  1661.  
  1662.                                     LT_UnlockWindow(LocalWindow);
  1663.  
  1664.                                     LT_ShowWindow(Handle,TRUE);
  1665.                                 }
  1666.  
  1667.                                 break;
  1668.                         }
  1669.                     }
  1670.                 }
  1671.             }
  1672.             while(!Done);
  1673.  
  1674.             PopWindow();
  1675.         }
  1676.  
  1677.         LT_DeleteHandle(Handle);
  1678.     }
  1679.  
  1680.     if(Default)
  1681.         return((BYTE)(!Cancel));
  1682.     else
  1683.     {
  1684.         if(PrivateConfig -> ScreenConfig -> DisplayMode != LocalConfig -> ScreenConfig -> DisplayMode || Stricmp(PrivateConfig -> ScreenConfig -> FontName,LocalConfig -> ScreenConfig -> FontName) || PrivateConfig -> ScreenConfig -> FontHeight != LocalConfig -> ScreenConfig -> FontHeight || PrivateConfig -> ScreenConfig -> ColourMode != LocalConfig -> ScreenConfig -> ColourMode)
  1685.             return(TRUE);
  1686.  
  1687.         if(PrivateConfig -> ScreenConfig -> MakeScreenPublic != LocalConfig -> ScreenConfig -> MakeScreenPublic || PrivateConfig -> ScreenConfig -> ShanghaiWindows != LocalConfig -> ScreenConfig -> ShanghaiWindows)
  1688.             return(TRUE);
  1689.  
  1690.         if(PrivateConfig -> ScreenConfig -> Blinking != LocalConfig -> ScreenConfig -> Blinking && (LocalConfig -> ScreenConfig -> ColourMode == COLOUR_EIGHT || LocalConfig -> ScreenConfig -> ColourMode == COLOUR_SIXTEEN))
  1691.             return(TRUE);
  1692.  
  1693.         if(PrivateConfig -> ScreenConfig -> FasterLayout != LocalConfig -> ScreenConfig -> FasterLayout && LocalConfig -> ScreenConfig -> ColourMode != COLOUR_MONO)
  1694.             return(TRUE);
  1695.  
  1696.         if(PrivateConfig -> ScreenConfig -> TitleBar != LocalConfig -> ScreenConfig -> TitleBar || PrivateConfig -> ScreenConfig -> StatusLine != LocalConfig -> ScreenConfig -> StatusLine || PrivateConfig -> ScreenConfig -> UseWorkbench != LocalConfig -> ScreenConfig -> UseWorkbench || PrivateConfig -> ScreenConfig -> Depth != LocalConfig -> ScreenConfig -> Depth || PrivateConfig -> ScreenConfig -> OverscanType != LocalConfig -> ScreenConfig -> OverscanType || PrivateConfig -> ScreenConfig -> DisplayWidth != LocalConfig -> ScreenConfig -> DisplayWidth || PrivateConfig -> ScreenConfig -> DisplayHeight != LocalConfig -> ScreenConfig -> DisplayHeight)
  1697.             return(TRUE);
  1698.  
  1699.         if(PrivateConfig -> ScreenConfig -> ShareScreen != LocalConfig -> ScreenConfig -> ShareScreen || PrivateConfig -> ScreenConfig -> SplitStatus != LocalConfig -> ScreenConfig -> SplitStatus)
  1700.             return(TRUE);
  1701.  
  1702.         if(strcmp(PrivateConfig -> ScreenConfig -> PubScreenName,LocalConfig -> ScreenConfig -> PubScreenName) && LocalConfig -> ScreenConfig -> UseWorkbench)
  1703.             return(TRUE);
  1704.  
  1705.         if(LocalConfig -> ScreenConfig -> UsePens != PrivateConfig -> ScreenConfig -> UsePens || memcmp(LocalConfig -> ScreenConfig -> PenArray,PrivateConfig -> ScreenConfig -> PenArray,sizeof(UWORD) * 12))
  1706.             return(TRUE);
  1707.  
  1708.         return(FALSE);
  1709.     }
  1710. }
  1711.